<?php
include_once '../db_conecta_adodb.inc.php';
include_once '../function.inc.php';
$rs=sql("SELECT ID_PRICE_PERIOD,DT_FROM,DATE_ADD(DT_TO,INTERVAL 1 DAY) AS DT_TO,DCM_PRICE FROM u172676809_fcac.T_PRICE_PERIOD WHERE DT_TO >= DATE_FORMAT(CURDATE(), '%Y-%m-01') order by 1","");
$return=array();
while ($row=siguiente($rs)){
	$color = get_color($row->DCM_PRICE);//sprintf('#%06x',rand(0,16777215));
	$period=array('id' => $row->ID_PRICE_PERIOD,
				  'title' => 'U$S '.$row->DCM_PRICE,
				  'start'=> $row->DT_FROM,
				  'end'=> $row->DT_TO,
				  'allDay'=> true,
				  'color'=> $color);
	//var_dump($period);
	array_push($return, $period);
	//var_dump($return);

    //$period.="{id: '".$row->ID_PRICE_PERIOD."',title:'U\$S ".$row->DCM_PRICE."',start:'".$row->DT_FROM."',end:'".$row->DT_TO."',allDay:'true',color:'".$color."'},";
}
//quito la ultima coma
//$period = substr($period, 0, -1);
echo json_encode($return);